 import 'package:flutter/material.dart';

class Nav{
  static destroyNav(context, pageContent) {
    var page = _wrapDartTheme(pageContent);
    Navigator.pushAndRemoveUntil(context,MaterialPageRoute(builder: (context) => page), (route) => route == null);
  }

  static nav(context, pageContent) {
    return Navigator.push(context, MaterialPageRoute(builder: (context) => pageContent));
  }

  static wrapNav(context, pageContent) {
    var page = _wrapDartTheme(pageContent);
    return Navigator.push(context, MaterialPageRoute(builder: (context) => page));
  }

  static _wrapDartTheme(pageContent){
    return MaterialApp(
      title: '易卖通',
      theme: new ThemeData.dark(),
      home: new Scaffold(
        body: new Center(
          child: pageContent,
        ),
      ),
    );
  }

 }